/*
 * Created on 26.02.2004
 * Local Projects Database
 * Mihai Postelnicu (mihai@ro-gateway.org)
 * (c) 2003 by eRomania Gateway
 */
package ro.gateway.aida.obj.searchrows;

import java.util.Comparator;


/**
 * @author Mihai Postelnicu<p>
 *
 *  e-mail (mihai@ro-gateway.org)<br>
 * (c) 2003 by eRomania Gateway<p>
 */
public class PersonSelectorRow {
    protected String firstNames;
    protected String lastName;
    protected String orgName;
    protected long id;
    protected long orgId;

    public PersonSelectorRow() {
        super();
        id = -1;
        orgId = -1;
        firstNames="Undefined";
        lastName="";
        orgName = "NONE";
    }

    /**
     * @return
     */
    public long getId() {
        return id;
    }

    /**
     * @return
     */
    public long getOrgId() {
        return orgId;
    }

    /**
     * @return
     */
    public String getOrgName() {
        return orgId!=0?orgName:"--";
    }

    /**
     * @return
     */
    public String getPersonName() {
        return firstNames+" "+lastName;
    }

    /**
     * @param l
     */
    public void setId(long l) {
        id = l;
    }

    /**
     * @param l
     */
    public void setOrgId(long l) {
        orgId = l;
    }

    /**
     * @param string
     */
    public void setOrgName(String string) {
        orgName = string;
    }


   public static class orgNameComparator implements Comparator {
        public int compare(Object o1, Object o2) {
            PersonSelectorRow t1 = (PersonSelectorRow) o1;
            PersonSelectorRow t2 = (PersonSelectorRow) o2;

            return (t1.getOrgName().toUpperCase().compareTo(t2.getOrgName()
                                                              .toUpperCase()));
        }
    }

	public static class personNameComparator implements Comparator {
        public int compare(Object o1, Object o2) {
            PersonSelectorRow t1 = (PersonSelectorRow) o1;
            PersonSelectorRow t2 = (PersonSelectorRow) o2;

            return (t1.getPersonName().toUpperCase().compareTo(t2.getPersonName()
                                                                 .toUpperCase()));
			                                                            
        }
    }
    public static final String LIST="PersonSelectorRow_LIST";
	/**
	 * @return Returns the firstNames.
	 */
	public String getFirstNames() {
		return firstNames;
	}
	/**
	 * @param firstNames The firstNames to set.
	 */
	public void setFirstNames(String firstNames) {
		this.firstNames = firstNames;
	}
	/**
	 * @return Returns the lastName.
	 */
	public String getLastName() {
		return lastName;
	}
	/**
	 * @param lastName The lastName to set.
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
}
